package org.canto.poss.service.impl;

import cn.hutool.json.JSONUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.canto.poss.domain.dto.SecUserDTO;
import org.canto.poss.domain.entity.Menu;
import org.canto.poss.instr.dao.primary.MenuMapper;
import org.canto.poss.instr.dao.slave.SecUserMapper;
import org.canto.poss.service.MenuService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Description:
 *
 * @author jsryin
 * @date 2024/12/11 23:25
 */
@Service
public class MenuServiceImpl implements MenuService {
    private Logger logger = LogManager.getLogger(MenuServiceImpl.class);

    @Resource
    private MenuMapper menuMapper;
    @Resource
    private SecUserMapper secUserMapper;

    @Override
    public List<Menu> selectList(Menu menu) {
        //主数据源数据
        List<Menu> list = menuMapper.findList(menu);
        //次数据源数据
        List<Map<String, Object>> userList = secUserMapper.findList(new SecUserDTO());
        logger.info("secUserMapper信息:{}", JSONUtil.toJsonStr(userList));
        return list;
    }
}
